﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PanelControl : MonoBehaviour
{
    // Start is called before the first frame update

    private Panelgroup[] PanelControls;

    private void OnEnable()
    {
        PanelControls = GetComponentsInChildren<Panelgroup>(true);
    }

    public void SwitchPanel(int panelgroupid)
    {
        foreach (Panelgroup group in PanelControls)
        {
            if (group.id == panelgroupid)
            {
                group.show();
            }
            else
            {
                group.hide();
            }
        }
    }
}
